package com.xzz.proxyForHand;

import java.lang.reflect.InvocationTargetException;

/**
 * 定义一个切面
 * @author: hhz
 * @create: 2022-03-15 13:41
 **/
public class MyAspect {
    /**
     * 拦截所有方法上携带 MyAopAnnotation 注解的方法
     */
    @MyAround(targetClass = MyAopAnnotation.class)
    public Object testAspect1(MyProceedingJoinPoint joinPoint)throws InvocationTargetException,IllegalAccessException{
        System.out.println("testAspect1");
        return joinPoint.proceed(joinPoint.getArgs());
    }

    /**
     * 拦截所有方法上携带 MyAopAnnotation 注解的方法
     */
    @MyAround(targetClass = MyAopAnnotation.class)
    public Object testAspect2(MyProceedingJoinPoint joinPoint)throws InvocationTargetException,IllegalAccessException{
        System.out.println("testAspect2");
        return joinPoint.proceed(joinPoint.getArgs());
    }
}
